'''
作业
'''
from math import pi

# # 1. 写一个生成式能够产生的数据为: 1, 4, 27, 256, 3125,…, 9**9
# g1 = (n ** n for n in range(1, 10))
# for num in g1:
#     print(num)
# # 2. 写一个生成式能够产生1-10中所有半径是偶数的圆的面积
# g2 = (pi * r ** 2 for r in range(1, 11) if r & 1 == 0)
# for num in g2:
#     print(num)
#
#
# # 3. 写一个生成式交换字典的键和值，产生一个新的字典
#
# def exchange_dic(dic1):
#     dic2 = {}
#     for key in dic1:
#         dic2[dic1[key]] = key
#     yield dic2
#
#
# g3 = exchange_dic({'a': 1, 'b': 2})
# print(next(g3))
# dict1 = {'a': 1, 'b': 2}
# dict2 = dict((dict1[key], key) for key in dict1)
# print(dict2)
# 4. 模块的自学：os，sys，calendar
